package com.ls.hnks.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 * 用户表
 * @TableName tb_user
 */
@TableName(value ="tb_user")
@Data
public class User implements Serializable {
    /**
     * ID，自增
     */
    @TableId(value = "id",type=IdType.AUTO) //主键回填
    private Integer id;

    /**
     * 用户姓名
     */
    private String name;

    /**
     * 排序号
     */
    private Integer num;

    /**
     * 用户名，可以设置用户，也可以不设
     */
    private String user;

    /**
     * 电话号码，不能重复
     */
    private String phone;

    /**
     * 密码
     */
    private String password;

    /**
     * 住址
     */
    private String address;

    /**
     * 权限，1管理员，2普通用户
     */
    @TableField("`Right`")
    private Integer right;

    /**
     * 微信头像的位置，首次授权或url不一样时写入
     */
    private String icon;

    /**
     * 分组ID
     */
    private Integer groupid;

    /**
     * 创建人ID
     */
    private Integer createuserid;

    /**
     * 备注
     */
    private String other;

    /** 删除标志（0代表存在 1代表删除） */
    private String deleteflag;

    /**
     * 创建时间
     */
    private Date createtime;

    /**
     * 联系人信息
     */
    @TableField(exist = false)
    private List<UserReservedPhone> userReservedPhoneList;


    /**
     * 分组名称
     */
    @TableField(exist = false)
    private String  groupName;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
            && (this.getUser() == null ? other.getUser() == null : this.getUser().equals(other.getUser()))
            && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
            && (this.getRight() == null ? other.getRight() == null : this.getRight().equals(other.getRight()))
            && (this.getIcon() == null ? other.getIcon() == null : this.getIcon().equals(other.getIcon()))
            && (this.getGroupid() == null ? other.getGroupid() == null : this.getGroupid().equals(other.getGroupid()))
            && (this.getCreateuserid() == null ? other.getCreateuserid() == null : this.getCreateuserid().equals(other.getCreateuserid()))
            && (this.getOther() == null ? other.getOther() == null : this.getOther().equals(other.getOther()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
        result = prime * result + ((getUser() == null) ? 0 : getUser().hashCode());
        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getRight() == null) ? 0 : getRight().hashCode());
        result = prime * result + ((getIcon() == null) ? 0 : getIcon().hashCode());
        result = prime * result + ((getGroupid() == null) ? 0 : getGroupid().hashCode());
        result = prime * result + ((getCreateuserid() == null) ? 0 : getCreateuserid().hashCode());
        result = prime * result + ((getOther() == null) ? 0 : getOther().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", num=").append(num);
        sb.append(", user=").append(user);
        sb.append(", phone=").append(phone);
        sb.append(", password=").append(password);
        sb.append(", address=").append(address);
        sb.append(", right=").append(right);
        sb.append(", icon=").append(icon);
        sb.append(", groupid=").append(groupid);
        sb.append(", createuserid=").append(createuserid);
        sb.append(", other=").append(other);
        sb.append(", createtime=").append(createtime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}